package com.naiterui.ehp.bs.cms.modules.base.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.naiterui.ehp.bs.cms.common.constants.DsName;
import com.naiterui.ehp.bs.cms.modules.base.entity.Hospital;
import com.naiterui.ehp.bs.cms.modules.base.vo.HospitalPageVO;
import com.naiterui.ehp.bs.cms.modules.base.vo.HospitalVO;

@DS(DsName.EHP)
public interface HospitalBaseMapper extends BaseMapper<Hospital> {

    List<HospitalVO> getByCityId(@Param("cityId") Long cityId);

    Page<HospitalPageVO> getPage(@Param("page") IPage<HospitalPageVO> page,
        @Param("ew") Wrapper<HospitalPageVO> entityWrapper);

    /**
     * 判断同城市医院名称是否存在重复
     * 
     * @param hospital
     * @return
     */
    int getHospitalByName(Hospital hospital);

    /**
     * 判断同城市医院名称是否存在重复
     *
     * @param hospital
     * @return
     */
    int getHospitalIsStopByName(Hospital hospital);

    void updateHospitalStatus(@Param("hospitalId") Long hospitalId, @Param("status") Integer status);

    @Select("select * from dr_hospital where id = #{hospitalId}")
    HospitalPageVO getById(@Param("hospitalId") Long hospitalId);
}
